﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
    xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
    xmlns:helpers="clr-namespace:UCOLOR.Helpers">

    <Style TargetType="helpers:ImageScrollViewer">
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BorderBrush" Value="#FF515151" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="helpers:ImageScrollViewer">
                    <Border Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition To="MouseOver" GeneratedDuration="00:00:00.3" />
                                    <VisualTransition From="MouseOver" GeneratedDuration="00:00:00.3" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Disabled"/>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Pressed" />
                                <VisualState x:Name="MouseOver" >
                                    <VisualState.Storyboard>
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetName="ZoomEdit" Storyboard.TargetProperty="Opacity" />
                                        </Storyboard>
                                    </VisualState.Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid Background="Transparent">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Border Background="#FF333333" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,0,0" Grid.Column="1" Grid.Row="1"
                                Visibility="{Binding Path=ComputedBothScrollBarsVisiblity, ElementName=ScrollContentControl, Mode=OneWay}" />
                            <helpers:RenderScrollContentControl x:Name="ScrollContentControl" Margin="{TemplateBinding Padding}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Content="{TemplateBinding Content}"
                                HorizontalScrollBarVisibility="{Binding Path=(ScrollViewer.HorizontalScrollBarVisibility), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                                VerticalScrollBarVisibility="{Binding Path=(ScrollViewer.VerticalScrollBarVisibility), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"/>
                            <ScrollBar Grid.Row="1" Orientation="Horizontal"
                                Visibility="{Binding Path=ComputedHorizontalScrollBarVisibility, ElementName=ScrollContentControl, Mode=OneWay}"
                                IsEnabled="{Binding Path=ComputedHorizontalScrollBarIsEnabled, ElementName=ScrollContentControl, Mode=OneWay}"
                                Minimum="{Binding Path=HorizontalMinimum, ElementName=ScrollContentControl, Mode=OneWay}"
                                Maximum="{Binding Path=HorizontalMaximum, ElementName=ScrollContentControl, Mode=OneWay}"
                                ViewportSize="{Binding Path=HorizontalViewportSize, ElementName=ScrollContentControl, Mode=OneWay}"
                                Value="{Binding Path=HorizontalValue, ElementName=ScrollContentControl, Mode=TwoWay}" />
                            <ScrollBar Grid.Column="1" Orientation="Vertical"
                                Visibility="{Binding Path=ComputedVerticalScrollBarVisibility, ElementName=ScrollContentControl, Mode=OneWay}"
                                IsEnabled="{Binding Path=ComputedVerticalScrollBarIsEnabled, ElementName=ScrollContentControl, Mode=OneWay}"
                                Minimum="{Binding Path=VerticalMinimum, ElementName=ScrollContentControl, Mode=OneWay}"
                                Maximum="{Binding Path=VerticalMaximum, ElementName=ScrollContentControl, Mode=OneWay}"
                                ViewportSize="{Binding Path=VerticalViewportSize, ElementName=ScrollContentControl, Mode=OneWay}"
                                Value="{Binding Path=VerticalValue, ElementName=ScrollContentControl, Mode=TwoWay}" />
                            <dxe:TrackBarEdit helpers:SimpleManipulationHelper.OverrideManipulation="True" x:Name="ZoomEdit" Opacity="0" HorizontalAlignment="Center" VerticalAlignment="Bottom" Grid.RowSpan="2" Grid.ColumnSpan="2" Margin="0,0,0,40" Width="150" Value="{Binding Zoom, RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" Minimum="{Binding MinimalZoom, RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" Maximum="{Binding MaximalZoom, RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" LargeStep="0.2" SmallStep="0.001" >
                                <!--BEGIN WPF-->
                                <dxe:TrackBarEdit.TickPlacement>
                                    <TickPlacement>None</TickPlacement>
                                </dxe:TrackBarEdit.TickPlacement>
                                <!--END WPF-->
                                <dxe:TrackBarEdit.StyleSettings>
                                    <dxe:TrackBarZoomStyleSettings />
                                </dxe:TrackBarEdit.StyleSettings>
                            </dxe:TrackBarEdit>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
